<template>
  <div>
    <p :style="{ background: colorStr }" @click="Fn">背景颜色</p>
  </div>
</template>

<script>
export default {
  data() {
    return { colorStr: "" };
  },
  methods: {
    Fn() {
      this.colorStr = `rgb(${Math.floor(Math.random() * 256)}, ${Math.floor(
        Math.random() * 256
      )}, ${Math.floor(Math.random() * 256)})`;
    },
  },
};
</script>

<style></style>
